package com.twu.biblioteca;

import java.io.*;
import java.util.ArrayList;
import java.util.List;

public class BibliotecaApp {

    private final PrintStream out;

    public BibliotecaApp(PrintStream out)
    {
        this.out = out;
    }

    public static void main(String[] args) {
        BibliotecaApp bib = new BibliotecaApp(System.out);
        bib.displayWelcomeMessage();

        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String input = "";
        try {
            while(true) {
                input = reader.readLine();
                if (input != null) {
                    int option = BibliotecaOptions.getOptionNumber(input);
                    BibliotecaOptions.values()[option].act(input, bib.out);
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public void displayWelcomeMessage() {
        out.println("Welcome to Biblioteca!");
    }
}
